package com.meida.student.app.scholartyrant.handler;


import com.meida.common.base.entity.EntityMap;
import com.meida.common.mybatis.interceptor.GetInterceptor;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.msg.client.entity.MsgContent;
import com.meida.msg.client.entity.MsgReceive;
import org.springframework.stereotype.Component;

/**
 * 接收消息详情信息扩展
 */
@Component("SMsgDetailGetHandler")
public class SMsgDetailGetHandler implements GetInterceptor {

    @Override
    public void prepare(CriteriaQuery cq, EntityMap entityMap) {
        Long msgUserId = entityMap.getLong("msgUserId");
        cq.select(MsgReceive.class, "msgUserId", "msgId", "readState", "deleted");
        cq.select(MsgContent.class, "msgTypeId", "msgTitle", "msgDescribe", "msgImage", "msgContent");
        cq.eq(MsgReceive.class, "msgUserId", msgUserId);
        cq.createJoin(MsgContent.class);
    }

}
